#include "N1Number.h"
#include "N1Lib.h"

N1Number::N1Number(int i) : m_number(i) 
{ 
}

N1Number::N1Number(const N1Number &num)
{
    this->m_number = num.m_number;
}

uint32 N1Number::size() const 
{
    return sizeof(m_number);
}
 
pcstr N1Number::name() const 
{
    return "N1Number";
}

bool N1Number::isEqualTo(N1Object *obj)
{
    N1Number *number = dynamic_cast<N1Number*>(obj);
    if(!number) return false;
    if(this->m_number == number->m_number) return true;
    return false;
}

#ifdef N1LIB_SELFTEST

N1TEST(N1NumberTest)
{
    N1Number n1(123);
    N1Number n2(234);
    N1Number n3(123);

    N1CHECK(!n1.isEqualTo(&n2), 1);
    N1CHECK(!n2.isEqualTo(&n1), 2);

    N1CHECK(n1.isEqualTo(&n3), 10);
    N1CHECK(n3.isEqualTo(&n1), 11);
}

#endif //N1LIB_SELFTEST
